package WaiBao;

import java.util.Arrays;

public class LiLin {
    public static void main(String[] args) {
        String[] name = {"赵晓红(班长)", "李方正(团支书)", "小李(学习委员)", "曲志刚(体育委员)", "李佳", "王丽", "王悦", "王涛", "李浩存", "立志", "黄之光", "倪大红",
                "王志文", "张劲松", "曲小刚", "杨颖", "迪丽热巴", "鹿晗", "卢文迪", "黄志愿", "吉鲁", "姜子牙", "张建辉", "李昕", "李志康", "康熙", "乾隆", "朱元璋",
                "李世民", "李琳(学生)"};//考生本人: 李琳(学生)
        int[] Age = {20, 19, 18, 21, 20, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 21};//考生年龄：21岁

        double[] orange1 = {78, 80, 64, 70, 78, 69, 78, 84, 80, 90, 90, 87, 81, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] orange2 = {85, 75, 89, 76, 88, 67, 68, 79, 90, 94, 60, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[] orange3 = {74, 91, 94, 85, 71, 61, 78, 89, 84, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double hongzhao;//代表每个学生的总分
        double tangguo;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            hongzhao  = orange1[i] + orange2[i] +orange3[i];
//            tangguo = ( hongzhao * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + hongzhao);
//            System.out.println(name[i] + "的平均分为:" +tangguo);
//        }


        double hululu1 = 0, hululu2 = 0;
        double[] liulan = new double[30];
//        for (int i = 0; i < 30; i++) {
//            hululu1 = orange1[i] + orange2[i] + orange3[i];
//            hululu2= (hululu1 * 1.0) / 3;
//            liulan[i] = hululu2;
//        }
//
//        for (int i = 0; i < liulan.length - 1; i++) {
//            for (int j = 0; j < liulan.length - i - 1; j++) {
//                if (liulan[j] < liulan[j + 1]) {
//                    double tep = liulan[j];
//                    liulan[j] = liulan[j + 1];
//                    liulan[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(liulan[i]);
//        }


        double yingzi1 = 0,yingzi2 = 0, yingzi3 = 0;//计算每门课的平均分
        double taohua1 = 0,taohua2 = 0, taohua3 = 0;//计算每门课标准差
        double xingzi1 = 0,xingzi2 = 0, xingzi3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < orange1.length; i++) {
            sum2+=orange1[i];
        }
        yingzi1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+yingzi1);
        double Sum = 0;
        for (int i = 0; i < orange2.length; i++) {
            Sum+=orange2[i];
        }
        yingzi2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+yingzi2);
        double sum = 0;
        for (int i = 0; i <orange3.length; i++) {
            sum+=orange3[i];
        }
        yingzi3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+yingzi3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < orange1.length; i++) {
            c1+= (orange1[i] - yingzi1)*(orange1[i] -yingzi1);
        }
        taohua1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+taohua1);

        for (int i = 0; i < orange2.length; i++) {
            c2+= (orange2[i] - yingzi2)*(orange2[i] - yingzi2);
        }
        taohua2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+taohua2);

        for (int i = 0; i < orange3.length; i++) {
            c3+= (orange3[i] -yingzi3)*(orange3[i] - yingzi3);
        }
        taohua3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+taohua3);
////
//        Arrays.sort(orange1);
//        Arrays.sort(orange2);
//        Arrays.sort(orange3);
//        xingzi1 =( orange1[14]+orange1[15])*1.0/2;
//        xingzi2 =( orange2[14]+orange2[15])*1.0/2;
//        xingzi3 =( orange3[14]+orange3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+xingzi1);
//        System.out.println("微生物学的中位数为:"+xingzi2);
//        System.out.println("人体组织解剖学的中位数为:"+xingzi3);
//



    }
}
